package com.example.day03;

import com.example.day03.domain.MyInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class Day03Application implements CommandLineRunner {
    @Value("${jojo}")
    private String jojo;
    @Autowired
    private MyInfo myInfo;
    @Autowired
    private Environment environment;

    public static void main(String[] args) {
        SpringApplication.run(Day03Application.class, args);

    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println(jojo);
        System.out.println(myInfo.getName());
        System.out.println(environment.getProperty("my.address"));
    }
}
